<?php
/**
 * Created by PhpStorm.
 * User: yuanluke
 * Date: 4/30/16
 * Time: 11:54
 */

namespace App\Http\Utils\Common;


class CollectionUtils {

    public static function parseArrayToUrlPattern(array $params) {
		$urlString = '?';
		foreach ($params as $key=>$val) {
			$urlString = $urlString.$key.'='.$val.'&';
		}
	    return $urlString;
    }

    public static function dumpArray($vars, $label = '', $return = true) {
        if (ini_get('html_errors')) {
            $content = "<pre>\n";
            if ($label != '') {
                $content .= "<strong>{$label} :</strong>\n";
            }
            $content .= print_r($vars, true);
            $content .= "\n\n";
        } else {
            $content = $label . " :\n" . print_r($vars, true);
        }
        if ($return) { return $content; }
        echo $content;
        return $content;
    }



}